package enemy.actions;

import enemy.Enemy;

public class Rotate implements Action {
	
	private boolean right;
	private float degrees;
	private float degreesRotated;
	
	public Rotate(boolean right, float degrees) {
		this.right = right;
		this.degrees = degrees;
		this.degreesRotated = 0;
	}

	@Override
	public boolean execute(Enemy enemy) {
		if(right) {
			enemy.turnRight();
		} else {
			enemy.turnLeft();
		}
		
		degreesRotated+=Enemy.ROTATION_STEP;
		
		if(degreesRotated>=degrees) {
			degreesRotated = 0;
			return true;
		}
		
		return false;
	}

}
